from pd.const import *

def standardScore(p0move, p1move):
    if p0move == C:
        if p1move == C: return (3.0, 3.0)
        else: return (0.0, 5.0)
    else:
        if p1move == C: return (5.0, 0.0)
        else: return (1.0, 1.0)

def fixedLengthTournament(p0, p1, rounds, scoreFn):
    p0.reset()
    p1.reset()

    p0score = 0.0
    p1score = 0.0
    for i in range(rounds):
        p0move = p0.move()
        p1move = p1.move()
        scores = scoreFn(p0move, p1move)
        p0score += scores[0]
        p1score += scores[1]
        p0.tell(p0move, p1move)
        p1.tell(p1move, p0move)
        # print(p0move, p1move)
    p0score /= p0.handicap
    p1score /= p1.handicap
    return p0score, p1score
